
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js" class="pre"></script>
<script src="dist/msal.js" class="pre"></script>
<script class="pre">
    var userAgentApplication = new Msal.UserAgentApplication('0813e1d1-ad72-46a9-8665-399bba48c201', null, function (errorDes, token, error, tokenType, instance) {
        // this callback is called after loginRedirect OR acquireTokenRedirect. It's not used with loginPopup,  acquireTokenPopup.
        if (error) {
            console.log(error + ": " + errorDes);
        }
        else
            console.log("Token type = " + tokenType);

    })

    userAgentApplication.loginPopup(["user.read"]).then(function (token) {
        var user = userAgentApplication.getUser();
        if (user) {
            console.log("signed in sucessfully");

            // get an access token
            userAgentApplication.acquireTokenSilent(["user.read"]).then(function (token) {
                console.log("Success acquiring access token");
            }, function (error) {
                // interaction required
                if (error.indexOf("interaction_required" != -1)) {
                    userAgentApplication.acquireTokenPopup(["user.read"]).then(function (token) {
                        console.log("Success acquiring access token");
                    }, function (error) {
                        console.log("Failure acquiring token: " + error);
                    });
                }
            });
        } else {
            console.log("signed in failure");
        }
    }, function (error) {
        console.log("error: " + error);
        });


</script>